using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Enemy_Health : Entity_Health
{
    private Enemy enemy;
    private PlayerQuestManager playerQuestManager;
    protected override void Start()
    {
        enemy = GetComponent<Enemy>();
        playerQuestManager = Player.Instance.questManager;
    }
    public override bool TakeDamage(float damage, float elementalDamage, ElementType elementialType, Transform attacker, bool isCrit)
    {
        base.TakeDamage(damage, elementalDamage, elementialType, attacker, isCrit);
        if (isDead)
            return false;
        if (attacker.TryGetComponent(out Player player))
            enemy.TryEnterBattleState(attacker);
        return true;
    }

    public override void Dead()
    {
        base.Dead();
        playerQuestManager.TryAddQuestAmount(enemy.questTargetId);
    }
}
